Namespace Entities

    Public Class GoalRating

        Protected Sub New()

        End Sub

        Public Sub New(ByVal pe As PerformanceEvaluation, ByVal g As Goal, ByVal rl As RatingLevel)

            Me.PerformanceEvaluation = pe
            Me.Goal = g
            Me.RatingLevel = rl

        End Sub

        Private _performanceEvaluation As PerformanceEvaluation
        Public Overridable Property PerformanceEvaluation() As PerformanceEvaluation
            Get
                Return (_performanceEvaluation)
            End Get
            Set(ByVal value As PerformanceEvaluation)
                _performanceEvaluation = value
            End Set
        End Property

        Private _goal As Goal
        Public Overridable Property Goal() As Goal
            Get
                Return _goal
            End Get
            Set(ByVal value As Goal)
                _goal = value
            End Set
        End Property

        Private _ratingLevel As RatingLevel
        Public Overridable Property RatingLevel() As RatingLevel
            Get
                Return _ratingLevel
            End Get
            Set(ByVal value As RatingLevel)
                _ratingLevel = value
            End Set
        End Property

        Public Overrides Function Equals(ByVal obj As Object) As Boolean

            If obj.GetType Is GetType(GoalRating) Then

                Dim gr As GoalRating = CType(obj, GoalRating)
                If Me.Goal.Id = gr.Goal.Id And Me.PerformanceEvaluation.Id = gr.PerformanceEvaluation.Id Then
                    Return True
                Else
                    Return False
                End If
            End If

            Return False

        End Function

        Public Overrides Function GetHashCode() As Integer

            Return Me.PerformanceEvaluation.Id.GetHashCode()

        End Function

    End Class

End Namespace
